package com.clientmanage.controller;

import com.clientmanage.domain.vo.clientInfoVo;
import com.clientmanage.service.ICustomerService;
import com.clientmanage.domain.resp.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author HUANG
 * @since 2025-06-30
 */
@RestController
@RequestMapping("/pets")
public class PetController {

    @Autowired
    private ICustomerService customerService;

    /**
     * 编辑宠物
     * 接口地址：PUT /pets/{id}
     */
    @PutMapping("/{id}")
    public Result<Void> updatePet(@PathVariable String id, @RequestBody clientInfoVo vo) {
        vo.setPetId(id);
        customerService.updatePet(vo);
        return Result.success();
    }

    /**
     * 删除宠物
     * 接口地址：DELETE /pets/{id}
     */
    @DeleteMapping("/{id}")
    public Result<Void> deletePet(@PathVariable String id) {
        customerService.deletePetById(id);
        return Result.success();
    }
}
